#include <stdio.h>
unsigned int IsPerfect(unsigned int m)
{
    int i,sum=0;
    if(0==m)
    {
        printf("Wrong input!Please input a number that is larger than 0.\n");
        exit(0);
    }
    for(i=1;i<m;i++)
    {
        if(0==m%i)
        {
            sum+=i;
        }
    }
    if(sum==m)
    {
        printf("%u is a perfect number\n",m);
        return 1;
    }
    else
    {
        printf("%u is not a perfect number\n",m);
        return 0;
    }
}
void main()
{
    unsigned int m;
    printf("please input a number:");
    scanf("%u",&m);
    IsPerfect(m);
}
